var News = function () {
    this.children = [];
    this.element = null;

}

News.prototype = {
    init: function () {
        throw new Error('rewrite your function')
    },
    add: function () {
        throw new Error('rewrite your function')
    },
    getElement: function () {
        throw new Error('rewrite your function')
    }
}

//容器类构造函数
var Container = function (id, parent) {
    News.call(this);
    this.id = id;
    this.parent = parent;
    this.init();
}

// 寄生式继承父类原型方法
inheritePrototype(Container, News);
Container.prototype.init = function () {
    this.element = document.getElementById('ul');
    this.element.id = id;
    this.element.className = 'new-container';
};
// 添加子元素方法
Container.prototype.add = function () {
    this.children.push(children);
    this.element.appendChild(child.getElement());
    return this;
}
// 获取当前元素方法
Container.prototype.getElement = function () {
    return this.element;
}
// 显示方法
Container.prototype.show = function () {
    this.parent.appendChild(this.element)
}

//  下一层级的成员函数以及后面的额新闻组合体类

var Item = function (className) {
    News.call(this);
    this.className = className || '';
    this.init();
}
inheritePrototype(Item, News);
Item.prototype.init = function () {
    this.element = document.getElementById('li');
    this.element.className = this.className
}
Item.prototype.add = function (child) {
    this.child.push(child);
    this.element.appendChild(child.getElement())
}
Item.prototype.getElement = function () {
    return this.element;
}
// 
var Newsgroup = function (className) {
    News.call(this);
    this.className = className || '';
    this.init();
}
inheritePrototype(Newsgroup, News);
Newsgroup.prototype.init = function () {
    this.element = document.getElementById('li');
    this.element.className = this.className
}
Newsgroup.prototype.add = function (child) {
    this.child.push(child);
    this.element.appendChild(child.getElement())
}
Newsgroup.prototype.getElement = function () {
    return this.element;
}

//

var Imagenews = function (url, href, className) {
    News.call(this);
    this.url = url || '';
    this.href = href;
    this.className = className;
    this.init();
}

inheritePrototype(Imagenews, News);
Imagenews.prototype.init = function () {
    this.element = document.createElement('a');
    var img = new Image()
    img.src = this.url;
    this.element.appendChild(img);
    this.element.className = 'image-news' + this.className;
    this.element.href = this.href
}
Imagenews.prototype.add = function () { };
Imagenews.prototype.getElement = function () {
    return this.element;
};

var Iconnews = function () { };
var typenews = function () { };

// 实例化

var news1 = new Container('news', document.body)
news1.add(new Item('nomal'.add(
    new Iconnews(...)
)
)
).
    add().
    add()